<%@ taglib uri="/WEB-INF/myfaces_html.tld" 	prefix="h" %>
<%@ taglib uri="/WEB-INF/myfaces_core.tld" 	prefix="f" %>
<%@ taglib uri="/WEB-INF/tomahawk.tld"     	prefix="t" %>

<f:view>    
    <jsp:include page="intestazionePortale.jsp"/>


    <%
        it.azienda.moretti.modello.BeanAppPrenotazione appPrenot = (it.azienda.moretti.modello.BeanAppPrenotazione) it.azienda.framework.utilita.Utilita.getRequest().getAttribute("beanAppPrenotazione");
    %>

    <script language="javascript" src="./script/popup_full_center.js"></script>
    
    <br />
   

    <h:panelGrid styleClass="navigazione_Table"/>   
    <h:form id="erroriDataBase" rendered="false">
        <f:verbatim>
            <table><td align="left" class="messaggiErrore" height="2px"></f:verbatim>           
                <h:messages style="color: red" showDetail="true" showSummary="false"/>
                <f:verbatim></td></table></f:verbatim>
            </h:form>  
            <h:form>
                <t:saveState value="#{beanAppPrenotazione}"/>            
                <t:dataTable id="gestisciTratta" var="lista" value="#{beanAppPrenotazione.listaCorseAndata}" preserveDataModel="true"           
                             styleClass="dataTableGestisci_Table" 
                             headerClass="dataTableGestisci_Header"
                             rowClasses="dataTableGestisci_Row1, dataTableGestisci_Row2"          
                             columnClasses="dataTableGestisci_Column" 
                             
                              >  

            <t:column width="8%">
                <f:facet name="header"  >
                    <t:outputText value="Linea" />
                </f:facet>
                <t:outputText value="#{lista.beanLinea.descrizione}" /> 
            </t:column> 


            <t:column width="10%">
                <f:facet name="header"  >
                    <t:outputText value="Data Partenza" />
                </f:facet>
                <t:outputText value="#{lista.dataApp}">
                </t:outputText>       
            </t:column> 

            <t:column width="10%">
                <f:facet name="header"  >
                    <t:outputText value="Orario Partenza" />
                </f:facet>
                <t:outputText value="#{lista.oraPartenza}:#{lista.minutiPartenza}" /> 
            </t:column> 

            <t:column width="20%">
                <f:facet name="header"  >
                    <t:outputText value="Comune Partenza" />
                </f:facet>
                <t:outputText value="#{lista.beanComunePartenza.descrizione}" /> 
            </t:column> 

            <t:column width="10%">
                <f:facet name="header"  >
                    <t:outputText value="Orario Arrivo" />
                </f:facet>
                <t:outputText value="#{lista.oraArrivo}: #{lista.minutiArrivo}" /> 
            </t:column> 

            <t:column width="20%">
                <f:facet name="header"  >
                    <t:outputText value="Comune Arrivo" />
                </f:facet>
                <t:outputText value="#{lista.beanComuneArrivo.descrizione}" /> 
            </t:column> 


            <t:column width="10%">
                <f:facet name="header"  >
                    <t:outputText value="Corsa Andata" />
                </f:facet>
                <t:outputText value="#{lista.tariffaSemp}" /> 
            </t:column> 
            <t:column width="10%">
                <f:facet name="header"  >
                    <t:outputText value="Corsa A/R" />
                </f:facet>
                <t:outputText value="#{lista.tariffaAR}" /> 
            </t:column> 
            <t:column width="2%" headerstyleClass="dataTableGestisci_Header_Trasparent">
                <f:facet name="header">
                    <t:outputText value=""/>
                </f:facet>
                <h:commandLink dir="RTL" title="corsa di andata" action="#{dettaglioPrenotazione.caricaCorsaAndata}" rendered="#{beanAppPrenotazione.statoPrenotazione eq 'A'}">
                    <t:graphicImage url="/image/salva.png" border="0"/>
                    <f:param name="idBean" value="#{lista.id}" />
                    <f:param name="dataPartenza" value="#{lista.dataApp}" />
                    <f:param name="nomeBean" value="beanTratta" />                            
                </h:commandLink>
            </t:column>
        </t:dataTable>   

        <f:verbatim> 

            <table style="width: 99%">
                <tr>
                    <td> *Il costo del biglietto si riferisce alla tariffa standard, quindi senza sconti...</td>
                </tr>
                <tr>
                    <td><br/><br/><br/></td> 
                </tr>
            </table>    
        </f:verbatim>
        <%if (appPrenot.getListaCorseRitorno().size() != 0) {%>
        <t:dataTable id="gestisciTratta2" var="lista" value="#{beanAppPrenotazione.listaCorseRitorno}" preserveDataModel="true"           
                     styleClass="dataTableGestisci_Table" 
                     headerClass="dataTableGestisci_Header"
                     rowClasses="dataTableGestisci_Row1, dataTableGestisci_Row2"          
                     columnClasses="dataTableGestisci_Column" 
                     
                      rendered="#{beanAppPrenotazione.statoPrenotazione eq 'R' || beanAppPrenotazione.statoPrenotazione eq 'P'}">  

            <t:column width="8%">
                <f:facet name="header"  >
                    <t:outputText value="Linea" />
                </f:facet>
                <t:outputText value="#{lista.beanLinea.descrizione}" /> 
            </t:column> 

            <t:column width="10%">
                <f:facet name="header"  >
                    <t:outputText value="Data Partenza" />
                </f:facet>
                <t:outputText value="#{lista.dataApp}">
                </t:outputText>       
            </t:column> 
            <t:column width="10%">
                <f:facet name="header"  >
                    <t:outputText value="Orario Partenza" />
                </f:facet>
                <t:outputText value="#{lista.oraPartenza}:#{lista.minutiPartenza}" /> 
            </t:column> 

            <t:column width="20%">
                <f:facet name="header"  >
                    <t:outputText value="Comune Partenza" />
                </f:facet>
                <t:outputText value="#{lista.beanComunePartenza.descrizione}" /> 
            </t:column> 

            <t:column width="10%">
                <f:facet name="header"  >
                    <t:outputText value="Orario Arrivo" />
                </f:facet>
                <t:outputText value="#{lista.oraArrivo}:#{lista.minutiArrivo}" /> 
            </t:column> 

            <t:column width="20%">
                <f:facet name="header"  >
                    <t:outputText value="Comune Arrivo" />
                </f:facet>
                <t:outputText value="#{lista.beanComuneArrivo.descrizione}" /> 
            </t:column> 


            <t:column width="10%">
                <f:facet name="header"  >
                    <t:outputText value="Corsa Andata" />
                </f:facet>
                <t:outputText value="#{lista.tariffaSemp}" /> 
            </t:column> 
            <t:column width="10%">
                <f:facet name="header"  >
                    <t:outputText value="Corsa A/R" />
                </f:facet>
                <t:outputText value="#{lista.tariffaAR}" /> 
            </t:column> 


            <t:column width="2%" headerstyleClass="dataTableGestisci_Header_Trasparent">
                <f:facet name="header">
                    <t:outputText value=""/>
                </f:facet>
                <h:commandLink dir="RTL" title="corsa di ritorno" action="#{dettaglioPrenotazione.caricaCorsaRitorno}" rendered="#{beanAppPrenotazione.statoPrenotazione eq 'R'}">
                    <t:graphicImage url="/image/salva.png" border="0"/>
                    <f:param name="idBean" value="#{lista.id}" />
                    <f:param name="nomeBean" value="beanTratta" />   
                    <f:param name="dataPartenza" value="#{lista.dataApp}" />
                </h:commandLink>
            </t:column>
        </t:dataTable>   
        <f:verbatim> 

            <table style="width: 99%">
                <tr>
                    <td> *Il costo del biglietto si riferisce alla tariffa standard, quindi senza sconti...</td>
                </tr>
                <tr>
                    <td><br/><br/><br/></td> 
                </tr>
            </table>    
        </f:verbatim> 

        <%}%>

        <f:verbatim> 

            <table class="dettaglio" style="width: 99%">
                <tbody>
                    <tr>
                        <td width="50px" style="font-size: 6.5pt" align="center">Cognome</td>
                        <td width="50px" style="font-size: 6.5pt" align="center">Nome</td>
                        <td width="200px" style="font-size: 6.5pt" align="center">Data Nascita</td>
                        <td width="50px" style="font-size: 6.5pt" align="center">Fascia</td>
                        <td width="50px" style="font-size: 6.5pt" align="center">Cellullare</td>
                        <td width="50px" style="font-size: 6.5pt" align="center">Email</td>
                        <td width="50px" style="font-size: 6.5pt" align="center">Tariffa</td>

                    </tr>
                </f:verbatim> 
                <t:dataList  rendered="#{beanAppPrenotazione.statoPrenotazione eq 'P'}" id="car" var="passegg" value="#{beanAppPrenotazione.listaPasseggeri}" 
                             rowIndexVar="rigaR" style= "color: Black; font-family: Arial; font-size: 7pt; width: 99%;">                       
                    <f:verbatim> <tr></f:verbatim>
                        <f:verbatim>
                            <td width="50px" align="center"> </f:verbatim>
                            <t:inputText id="cognome" value="#{passegg.cognome}" maxlength="40" required="true"> 
                            </t:inputText>
                            <h:message style="color: red" for="cognome" showDetail="true" showSummary="false" />

                            <f:verbatim></td> 

                            <td width="50px" align="center"> </f:verbatim>
                            <t:inputText id="nome" value="#{passegg.nome}" maxlength="40" required="true"> 
                            </t:inputText>
                            <h:message style="color: red" for="nome" showDetail="true" showSummary="false" />

                            <f:verbatim></td> 

                            <td width="200px" align="center"> </f:verbatim>
                            <t:inputDate id="dataNascita" popupCalendar="false" size="10" styleClass="dataNascita" required="true" value="#{passegg.datanascita}">
                                <f:convertDateTime pattern="dd/MM/yyyy" type="both" timeZone="Europe/Rome"/>
                            </t:inputDate>
                            <h:message style="color: red" for="dataNascita" showDetail="true" showSummary="false" />

                            <f:verbatim></td> 

                            <td width="50px" align="center"> </f:verbatim>
                            <t:selectOneMenu  value="#{passegg.idFascia}" onchange="submit()" >
                                <f:selectItems value="#{passegg.listaFasce}" />
                            </t:selectOneMenu> 
                            <f:verbatim></td>

                            <td width="50px" align="center"> </f:verbatim>
                            <t:inputText id="cellulare" value="#{passegg.cellulare}" maxlength="15"> 
                            </t:inputText>
                            <h:message style="color: red" for="cellulare" showDetail="true" showSummary="false" />

                            <f:verbatim></td> 

                            <td width="50px" align="center"> </f:verbatim>
                            <t:inputText id="email" value="#{passegg.email}" maxlength="40" required = "true"> 
                            </t:inputText>
                            <h:message style="color: red" for="email" showDetail="true" showSummary="false" rendered="true"/>

                            <f:verbatim></td>
                            <td width="50px" align="center"> </f:verbatim>
                            <t:inputText value="#{passegg.tariffaApp}" disabled="true"> 
                            </t:inputText>
                            <f:verbatim></td>


                        </tr></f:verbatim>
                </t:dataList>         



                <f:verbatim> 
                </tbody>
            </table>
            <br/>

            <f:verbatim> 
                <table style="width: 99%">
                    <tr style="height: 40px;">
                        <td width="100%" align="right"></f:verbatim> 
                            <h:commandLink dir="RTL" value="Riepiloga e conferma" onmousedown="return confirmUpdate(this);" title="esegui" action="#{dettaglioPrenotazione.confermaPrenotazione}" rendered="#{beanAppPrenotazione.statoPrenotazione eq 'P'}" >
                        </h:commandLink>   
                        <f:verbatim> 
                        </td>
                    </tr>
                </table>
            </f:verbatim> 



        </f:verbatim> 

    </h:form>
    <jsp:include page="footerPortale.jsp"/>

    <jsp:include page="/piePagina.jsp"/>    
</f:view>    